package com.mx.zb.mng.utils.context;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;

import org.springframework.core.annotation.Order;

//表示执行过滤顺序，值越小，越先执行
@Order(1)
//重点
@WebFilter(filterName = "md2CommonFilter", urlPatterns = "/*")
public class CommonFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain filterChain)
            throws IOException, ServletException {
    	
    	filterChain.doFilter(new CommonRequestWrapper((HttpServletRequest) req), resp);
    }

    @Override
    public void destroy() {

    }
}
